import QtQuick 2.5
import QtQuick.Controls 2.2
import QtQuick.Window 2.2
import com.mycompany.messaging 1.0
import Qt.example.qobjectSingleton 1.0

Window {
    visible: true
    width: 512
    height: 300

    property int someValue: MyApi.someProperty

    Text {
        id:text
        anchors.centerIn: parent
        text: "Hello World!"
    }
    Button {
        id: btn
        text: "setAuthor"
        width: 200
        height: 50
        onClicked: {
            message.author = "new author"
            console.log("someValue " + someValue)
        }
    }
    Message {
        id: message
        author: "Amelie"
        creationDate: new Date()
        // 直接实现相应信号的槽函数，自动连接
        onAuthorChanged: {
            text.text = author
        }
    }

    Component.onCompleted: {
        someValue = MyApi.doSomething()
    }


}
